package com.mooc.lib_sofa.bind

import androidx.databinding.BindingAdapter
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener

class SofaSmartBind {

    companion object{
        @JvmStatic
        @BindingAdapter("sofalistener")
        fun smartBindListener(smart:SmartRefreshLayout,listener:OnRefreshLoadMoreListener){
            //添加刷新头以及脚
            smart.setRefreshHeader(ClassicsHeader(smart.context))
            smart.setRefreshFooter(ClassicsFooter(smart.context))
            smart.setOnRefreshLoadMoreListener(listener)
        }
    }

}